'''
Created on 22 mai 2009

@author: theo
'''
import os

def appendFileContent(sourceFilename, openedDestinationFile):
    try:
        sourceFile = open(sourceFilename)
        while 1:
            line = sourceFile.readline()
            if line == '':
                break
            openedDestinationFile.write(line)
    finally:
        sourceFile.close()
        
def convertPdfToText(sourceFileName, destFileName):
    os.system("pdftotext \"" + sourceFileName+ "\" \"" + destFileName+"\" -enc Latin1")
    
    
def convertOpenDocumentToText(sourceFileName, destFileName):
    os.system("html2text \"" + sourceFileName+ "\" -o \"" + destFileName+"\" -enc Latin1")
    
def convertHTMLToText(sourceFileName, destFileName):
    os.system("odt2txt \"" + sourceFileName+ "\" --output=\"" + destFileName+"\" -enc Latin1")